package cn.jzq.demo.entity;

import cn.jzq.demo.form.StudentForm;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author jzq
 * @since 2018-05-22
 */
@TableName("general_student")
@Data
@ToString
@NoArgsConstructor
public class GeneralStudent extends Model<GeneralStudent> {

    private static final long serialVersionUID = 1L;

    @TableId
    private Integer id;

    @TableField(value = "stu_no")
    private String stuNo;

    private String name;

    private Integer classId;

    private Date createTime;

    private Date updateTime;

    public GeneralStudent(StudentForm form) {
        this.stuNo = form.getStuNo();
        this.name = form.getName();
        this.classId = form.getClassId();
    }

    public GeneralStudent(String stuNo, String name) {
        this.stuNo = stuNo;
        this.name = name;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
